<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
  <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> 
  <meta name="format-detection" content="telephone=no" />


 <link href="/css/style.css" rel="stylesheet" type="text/css" />
 <link rel="stylesheet" type="text/css" href="/myiconfont/iconfont.css">
 <link href="/iconfont/iconfont.css" rel="stylesheet" type="text/css" />


  <link href="/css/order.css" rel="stylesheet" type="text/css" />
  <!--<link href="css/h5_02.css" rel="stylesheet" type="text/css">--> 
  <!--<link href="css/h5_02.css" rel="stylesheet" type="text/css">--> 
  <link href="/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  <script src="/js/jquery-1.8.2.min.js"></script>


  <script type="text/javascript">
        var orderId = "5670a8630cf22dba031ab92e";
        var memberId = "5670a4f611565719e9e9c679";
        var queryFlag = "3";
        var sessionId = "5670b0df0cf22dba031ab9a2";

        var useSpecialCode = "0";

        var useCodeFlag = 0, usePassFlag = 0;
        var passId = "";


        function canPay(payType){
            if (useSpecialCode == 1){
                // 输入验证码
                var specialCode = $("#useSpecialCode").val();
                if (specialCode == ""){
                    showCode("请输入验证码");
                    return;
                }
                // 验证特殊验证码
                var checkUrl = "/Mdj/instructions/checkCode"
                var param = {
                    orderId:orderId,
                    instructionCode:specialCode
                };
                $.ajax({
                    url: checkUrl,
                    dataType: "json",
                    data:param,
                    success: function (data) {
                        var status = data.status;
                        if (status == 1){
                            // 核销成功 可以跳转支付
                            window.location.href = "/Mdj/pay/"+orderId+"?payFlag=2&payType="+payType+"&sessionId="+sessionId + "&s58=1";//1:生成新订单 2：未支付的重新支付 3：支付子订单
                        } else {
                            showCode(data.info);
                        }
                    },
                    error: function (data) {
                        showCode("服务器异常！！！");
                    }
                });
            } else {
                var param;
                var checkUrl;
                if(useCodeFlag==1 || usePassFlag==1){
                    if(useCodeFlag == 1){
                        var code = $("#code").val();//获取验证码
                        if(useCodeFlag==1 && (code==null || code == "")) {
                            alert("请输入验证码");
                            return false;
                        }
                    }

                    param ="&passId="+passId+"&code="+code+"&t="+new Date().getTime();
                    checkUrl = "/Mdj/wxOrder/usePass/"+orderId;
                }else{
                    param ="orderId="+orderId+"&t="+new Date().getTime();
                    checkUrl = "/Mdj/wxOrder/changeOrderNo";
                }
                $("#gopay"+payType).prop({'disabled': true});
                var ajax=InitAjax();
                ajax.open("POST", checkUrl, true);
                ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
                ajax.onreadystatechange = function() {
                    if (ajax.readyState == 4 && ajax.status == 200) {
                        var data=JSON.parse(ajax.responseText);
                        if(data.status == 1){
//                            document.getElementById("gopay"+payType).disabled = true;
                            window.location.href = "/Mdj/pay/"+orderId+"?payFlag=2&payType="+payType+"&sessionId="+sessionId;//1:生成新订单 2：未支付的重新支付 3：支付子订单
                        }else{
                            alert(data.info);
                            $("#gopay"+payType).removeAttr("disabled");
                            return;
                        }
                    }
                }
                //发送参数
                ajax.send(param);
            }
        }


        var selectPrice=0;
        function checkPrice(price){
            $("#30").removeClass("sel");
            $("#50").removeClass("sel");
            $("#100").removeClass("sel");
            $("#"+price).addClass("sel");
            selectPrice = price;
        }


        function finishOrder(){
            var ajax=InitAjax();
            var param ="orderId="+orderId+"&t="+new Date().getTime();
            var checkUrl = "/Mdj/wxOrder/finishOrder";
            ajax.open("POST", checkUrl, true);
            ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            ajax.onreadystatechange = function() {
                if (ajax.readyState == 4 && ajax.status == 200) {
                    var data=JSON.parse(ajax.responseText);
                    if(data.status == 1){  //服务完成刷新页面
                        alert("服务已完成");
                        window.location.reload();
                    }else{
                        alert(data.info);
                    }
                }
            }
            //发送参数
            ajax.send(param);
        }

        function reuseOrder(){
            var ajax=InitAjax();
            var param ="orderId="+orderId +"&t="+new Date().getTime();
            var checkUrl = "/Mdj/wxOrder/reuseOrder";
            ajax.open("POST", checkUrl, true);
            ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            ajax.onreadystatechange = function() {
                if (ajax.readyState == 4 && ajax.status == 200) {
                    var data=JSON.parse(ajax.responseText);
                    if(data.status == 1){  //服务完成刷新页面
                        window.location.reload();
                    }else{
                        alert(data.info);
                    }
                }
            }
            //发送参数
            ajax.send(param);
        }

        // 确认更改 表示客户接受美到家取消订单退款规则
        function cancelConfirm(type){
            // 关闭弹屏
            $("#confirmMsg").text("");
            $("#confirmWind").hide();

            var param = "orderId="+orderId +"&type="+type;
            var ajax=InitAjax();
            var url = "/Mdj/userRefunds/confirmCancel";
            ajax.open("POST", url, true);
            ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
            ajax.onreadystatechange = function() {
                if (ajax.readyState == 4 && ajax.status == 200) {
                    var data=JSON.parse(ajax.responseText);
                    var status = data.status;
                    if (status == -1){
                        showWarn(data.info);
                    }
                    window.location.reload();
                }
            }
            ajax.send(param);
        }

        // 取消订单
        function cancelOrder(){
            var host = window.location.host;
            var url = "/Mdj/userRefunds/cancelOrder";
            url = "http://" + host  + url;
            var data = {
                orderId:orderId
            };
            $.ajax({
                url:url,
                type:"post",
                data:data,
                dataType:"json",
                success:function(data){
                    var status = data.status;
                    if (status == 1 || status == 2 || status == 3){
                        // 已接单订单处理
                        showConfirm(data.info);
                    } else if (status == 14){
                        // 待确认订单 直接跳转确认
                        goExamine();
                    } else {
                        showWarn(data.info);
                    }
                },
                error:function(data){
                    alert("服务器异常")
                }
            });
        }

        function showWarn(msg) {
            $("#warnMsg").text(msg);
            $("#warnWind").show();
        }
        function closeWarn() {
            $("#warnMsg").text("");
            $("#warnWind").hide();
            window.location.reload();
        }

        function showConfirm(msg) {
            $("#confirmMsg").text(msg);
            $("#confirmWind").show();
        }

        function showCode(msg){
            $("#codeMsg").text(msg);
            $("#codeWind").show();
        }

        function closeCode(){
            $("#codeMsg").text("");
            $("#codeWind").hide();
            $("#useSpecialCode").focus();
        }


        // 跳转审核页填写取消订单
        function goExamine(){
            // 跳转 退款页
            var url = "/Mdj/wxOrder/examineDetail?memberId="+memberId+"&orderId="+orderId+"&queryFlag="+queryFlag;
            window.location.href = url;
        }
    </script> 
  <title>订单详情</title>
 </head> 
 <body class="b_gray"> 

  <div id="wrapper"> 
   <div id="scroller"> 


    <div id="main" style="padding:0px;">
     <div class="state_info"> 
      <h1>订单状态未知</h1>
      <p><span style=" color: #999; display: block; float: left;" th:text="'订单号:'+${orderDetail.id}"></span></p>
      <!--<p><span style="width:80px; color: #999; display: block; float: left">下单时间：</span>2015-12-16 07:55</p> -->
     </div> 
     <div class="order_info"> 
      <p><strong>预约时间：</strong><span th:text="${orderDetail.bookDayS}"></span></p>
      <p><strong>预约场次：</strong>
         <span th:if="${orderDetail.bookTime} == 1">上午第一场</span>
         <span th:if="${orderDetail.bookTime} == 3">下午第一场</span>
      </p>
      <p><strong>摄影师：</strong>暂未安排</p>
      <p><strong>地址：</strong>待电话沟通</p>
      <p><strong>联系人：</strong><span th:text="${orderDetail.userName}"></span></p>
      <p><strong>联系方式：</strong><span th:text="${orderDetail.mobile}"></span></p>
      <p><strong>男生人数：</strong><span th:text="${orderDetail.maleNum}"></span></p>
      <p><strong>女生人数：</strong><span th:text="${orderDetail.femaleNum}"></span></p>


      <p><strong>备注：</strong><span th:text="${orderDetail.extraMessage}"></span></p>
     </div> 
     <div class="makeup_info2"> 
      <dl> 
       <dt>
        <img src="/images/lxyh_avatar.jpg" alt="" />
       </dt> 
       <dd class="a_info"> 
        <p class="price"><span th:text="${orderDetail.price}"></span><span class="yuan">元</span></p>
       </dd> 
       <dd>
         订单金额（参考）：
       </dd> 
       <!--<dd>新娘妆</dd>--> 
       <dd>
        &nbsp;
       </dd> 
      </dl> 
     </div> 
    </div> 

   </div> 
  </div> 
  <div class="t_center" style=" height: 28px; margin-bottom:85px;"> 
   <button class="btn_warning_s1"><i class="ico_phone_2"></i><a href="tel:0532-8898-4336">联系客服</a></button>
  </div>

  <footer id="footer" class="foot">
   <ul>
    <li>
     <a href="/">
      <span class="img"><img src="/images/nav1.png"></span>
      <p>首页</p>
     </a>
    </li>
    <li>
     <a href="/hot/index">
      <span class="img"><img src="/images/nav2.png"></span>
      <p>动态</p>
     </a>
    </li>
    <li>
     <a href="/order/index">
      <span class="img"><img src="/images/nav3.png"></span>
      <p>预约</p>
     </a>
    </li>
    <li class="active">
     <a href="/user/index">
      <span class="img"><img src="/images/nav4.png"></span>
      <p>我的</p>
     </a>
    </li>
   </ul>
  </footer>
 </body>
</html>